import request from '/@/utils/request';
enum Api {

  GetProcessData='/api/grpcserver/processData',
  GroupStatistic = '/api/grpcserver/groupstatistic',
  CvWrite = '/api/grpcserver/cvWrite',
  ScWrite = '/api/grpcserver/scWrite',
  ScWrite29 = '/api/grpcserver/scWrite29',

  
  HkWrite = '/api/grpcserver/hkwrite',
  UnitCv = '/api/grpcserver/unitcv',
  UnitSc = '/api/grpcserver/unitsc',
  PlcGroup = '/api/grpcserver/plcgroup',
  BcrGroup = '/api/grpcserver/bcrgroup',
  HkGroup = '/api/grpcserver/hkgroup',
  UnitTag = '/api/grpcserver/unittag',
 
  BcrRead = '/api/grpcserver/bcrread',
  
  
  EnterJob='/api/grpcserver/enterjob',
  MoveJob='/api/grpcserver/movejob',
  AppointJob='/api/grpcserver/appointjob',
  RemoveAppointJob='/api/grpcserver/removeappoint',
  OutJob='/api/grpcserver/outjob',
  deleteInJob='/api/grpcserver/removeEnterJob',
  deleteOutJob='/api/grpcserver/removeOutJob',
  CompleteOutJob='/api/grpcserver/completeJob',
  CompleteInJob='/api/grpcserver/completeJob',
  ControlEquip='/api/grpcserver/controlequip',

  deleteMoveJob='/api/grpcserver/removeMoveJob',
  CompleteMoveJob='/api/grpcserver/completeJob'



}
// 获取调度数据
export const GetProcessData = (params?: any) => 
	request({
			url: Api.GetProcessData,
			method: 'post',
			data: params,
		});



export const ControlEquip = (params?: any) =>
    request({
        url: Api.ControlEquip,
        method: 'post',
        data: params,
    });

    

export const CompleteInJob = (params?: any) =>
    request({
        url: Api.CompleteInJob,
        method: 'post',
        data: params,
    });

export const CompleteMoveJob = (params?: any) =>
    request({
        url: Api.CompleteMoveJob,
        method: 'post',
        data: params,
    });

export const CompleteOutJob = (params?: any) =>
    request({
        url: Api.CompleteOutJob,
        method: 'post',
        data: params,
    });

export const GetEnterJob = () =>
	request({
		url: Api.EnterJob,
		method: 'get'
		
	});
export const GetAppointJob = () =>
    request({
        url: Api.AppointJob,
        method: 'get'

    });
export const RemoveAppointJob = (params?: any) =>
    request({
        url: Api.RemoveAppointJob,
        method: 'post',
        data: params,
    });
export const GetOutJob = () =>
    request({
        url: Api.OutJob,
        method: 'get'

    });
export const GetMoveJob=()=>
    request({
        url: Api.MoveJob,
        method: 'get'

    });


export const RemoveInJob = (params?: any) =>
    request({
        url: Api.deleteInJob,
        method: 'post',
        data: params,
    });
export const RemoveMoveJob = (params?: any) =>
    request({
        url: Api.deleteMoveJob,
        method: 'post',
        data: params,
    });

export const RemoveOutJob = (params?: any) =>
    request({
        url: Api.deleteOutJob,
        method: 'post',
        data: params,
    });

export const GetPlcGroup = (params?: any) =>
	request({
		url: Api.PlcGroup,
		method: 'post',
		data: params,
	});


export const GetBcrGroup = (params?: any) => 
	request({
			url: Api.BcrGroup,
			method: 'post',
			data: params,
		});


export const GetHkGroup = (params?: any) => 
	request({
			url: Api.HkGroup,
			method: 'post',
			data: params,
		});


export const getUnitTag = (params?: any) =>
    request({
        url: Api.UnitTag,
        method: 'post',
        data: params,
    });

export const getUnitCv = (params?: any) =>
    request({
        url: Api.UnitCv,
        method: 'post',
        data: params,
    });
export const getUnitSc = (params?: any) =>
    request({
        url: Api.UnitSc,
        method: 'post',
        data: params,
    });

export const ReadBcr = (params?: any) =>
    request({
        url: Api.BcrRead,
        method: 'post',
        data: params,
    });

export const WriteCv = (params?: any) =>
    request({
        url: Api.CvWrite,
        method: 'post',
        data: params,
    });

export const WriteSc = (params?: any) =>
    request({
        url: Api.ScWrite,
        method: 'post',
        data: params,
    });

 export const WriteSc29 = (params?: any) =>
        request({
            url: Api.ScWrite29,
            method: 'post',
            data: params,
        });
    

export const WriteHk = (params?: any) =>
    request({
        url: Api.HkWrite,
        method: 'post',
        data: params,
    });

export const statisticGroup = () =>
    request({
        url: Api.GroupStatistic,
        method: 'get',
        
    });

    export const isNumber=(value: string | number):boolean=>
    {
       return ((value != null) &&
               (value !== '') &&
               !isNaN(Number(value.toString())));
    }



